<?php
if(!defined('IN_IBEIKE')) {
	exit('Access Denied');
}

class table_city_deal_chats extends common_table
{
	public function __construct() {

		$this->_table = 'city_deal_chats';
		$this->_pk    = 'cid';

		parent::__construct();
	}

	public function add_chats($data, $return_insert_id = false){
		if($data && is_array($data)){
			return DB::insert($this->_table, $data, $return_insert_id = false);
		}
		return 0;
	}
	public function del_chats($data){
		if($data){
			return DB::delete($this->_table, $data);
		}
		return 0;
	}
	public function fetch_by_cid_iid($cid,$iid){
		return DB::fetch_all('SELECT * FROM %t WHERE cid=%d AND iid=%d ', array($this->_table,$cid,$iid));
	}
	public function fetch_all_by_cid($cid){
		if(!empty($cid)&&$cid){
			return DB::fetch_all('SELECT * FROM %t WHERE cid=%s',array($this->_table,$cid));//返回数组包含各个字段的值
		}
		return false;
	}
}
?>